// component/goods/goods.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    data:{
      type: Object,
      // 数据类型
      value:{}
      // 数据值
    }
  },
  options: {
    styleIsolation: 'apply-shared'
  },
  /**
   * 组件的初始数据
   */
  data: {
    imgUrl:getApp().globalData.imgUrl,
    listData: []
  },
  attached: function(){
    let componentData = this.properties.data
    let listData = this.properties.data.pmsProductTableDTO.solrProductDtos.records
    this.setData({
      componentData: componentData,
      listData: listData
    })
  },
  /**
   * 组件的方法列表
   */
  methods: {
    goMore() {
      let linkType = this.data.componentData.moreButtonLinkType
      let linkAppId =  this.data.componentData.moreButtonLinkAppId
      let linkUrl = this.data.componentData.moreButtonLinkUrl
      if (linkType == 'otherMiniProgram') { // 其他小程序跳转
        this.goMeita(linkAppId)
      } else if (linkType == 'miniPage') {
        wx.navigateTo({
          url: linkUrl
        })
      } else if(linkType == 'h5' && linkUrl!== '/packagBuy/pages/found/crmweb/index') {
        wx.navigateTo({
          url: '/packagBuy/pages/marketing/poster/posterh5/posterh5?h5Url=' + linkUrl
        })
      } else if(linkUrl == '/packagBuy/pages/found/crmweb/index') {
        wx.navigateTo({
          url: '/packagBuy/pages/found/crmweb/index'
        })
      }
    },
    goGoodsInfo(param) {
      const skuId = param.currentTarget.dataset.skuid
      wx.navigateTo({
        url: "/packageShop/pages/goodsInfo/goodsInfo?id=" + skuId
      })
    }
  }
})
